using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class PhoneMessageTemplateMap : EntityTypeConfiguration<PhoneMessageTemplate>
	{
		public PhoneMessageTemplateMap()
		{
			// Primary Key
			this.HasKey(t => t.TemplateId);

			// Properties
			this.Property(t => t.TemplateCode)
				.HasMaxLength(50);
				
			this.Property(t => t.TemplateType)
				.HasMaxLength(10);
				
			this.Property(t => t.TemplateName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.TemplateDetail)
				.IsRequired()
				.HasMaxLength(500);
				
			// Table & Column Mappings
			this.ToTable("PhoneMessageTemplate");
			this.Property(t => t.TemplateId).HasColumnName("TemplateId");
			this.Property(t => t.SourceId).HasColumnName("SourceId");
			this.Property(t => t.MerchantId).HasColumnName("MerchantId");
			this.Property(t => t.TemplateCode).HasColumnName("TemplateCode");
			this.Property(t => t.TemplateType).HasColumnName("TemplateType");
			this.Property(t => t.TemplateName).HasColumnName("TemplateName");
			this.Property(t => t.TemplateDetail).HasColumnName("TemplateDetail");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.CreateBy).HasColumnName("CreateBy");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.ExpressCompanyID).HasColumnName("ExpressCompanyID");
		}
	}
}

